package main

import "fmt"

type car struct {
	name string
	speed int
}

func (c car) run()  {
	fmt.Println(c.speed)
}

type Person struct {
	name string
	age int
	sex string
}

type Dog struct {
	sort string
	color string
}
func (p Person) printInfo()  {
	fmt.Printf("姓名：%s,年龄：%d,性别：%s\n",p.name,p.age,p.sex)

}

func (d Dog) pringInfo()  {
	fmt.Printf("类别：%s,毛色：%s\n",d.sort,d.color)
}
func main()  {
	c1:=car{"丰田",80}
	c1.run()

	p1:=Person{"王二狗",30,"男"}
	p1.printInfo()

	p2:=Person{"小李",21,"女"}
	p2.printInfo()

	d1:=Dog{"金毛","red"}
	d1.pringInfo()

	//子对象调用爹的方法

}


